import getpass
joe = me = 0
rounds = 1
while rounds <=5:
    print('第%d局开始了！\n1-剪刀 2-石头 3-布'%rounds)
    joe_input = getpass.getpass('Joe:')
    me_input = getpass.getpass('Me')
    if joe_input not in '123' or me_input not in '123' or len(me_input)!= 1 or len(joe_input)!= 1:
        print('只能输入1-3,重来')
        continue
    print('Joe出%s,我出%s'%(joe_input,me_input))
    distance = int(joe_input) - int(me_input)
    if distance == 0:
        print('平局')
        continue
    elif distance == 1 or distance == -2:
        joe += 1
        print('Joe 赢了')
    else:
        me += 1
        print('我赢了')
    if joe ==3 or me ==3:
        break
    rounds += 1
else:
    print('五局结束')
if joe == 3:
    print('Joe 是赢家')
else:
    print('我是赢家')
